/**
 * <p>Package : org.tea.springdata.mongdb.domain</p>
 * <p>E-Mail : ztlyde@gmail.com</p>
 */
package org.tea.springdata.mongdb.domain;

import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

/**
 * @author: John zhang
 * @version: 0.1
 */
@Document(collection = "person")
public class Person {

	@Id
	private String id;
	@Field
	private String name;
	private int age;
	@DBRef
	private Account account;

	@PersistenceConstructor
	public Person(String name, int age) {
		this.name = name;
		this.age = age;
	}

	public String getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public int getAge() {
		return age;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	@Override
	public String toString() {
		return "Person [id=" + id + ", name=" + name + ", age=" + age + "]";
	}
}
